﻿using B.S.Filtration.Read.Api.Application.Command.VendorItemsCommand;
using MediatR;
using B.S.Filtration.ErrorCode;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using B.S.Filtration.Read.Api.Dto;
using B.S.Filtration.Domain;

namespace B.S.Filtration.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class VendotItemsController : ControllerBase
    {
        private readonly IMediator mediator;

        public VendotItemsController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 查询供应商物品信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIPaging<List<VendorItemsDtos>>> QueryVendorItems([FromQuery]QueryVendorItemsCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询供应商物品信息(单条)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<VendorItems>>> ShowVendorItems([FromQuery]ShowVendorItemsCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
